from typing import Optional
from fastapi import Query
from pydantic import BaseModel

from schemas.baseRequest import PageRequest

# 列表请求
class DemoListRequest(PageRequest):
    name: Optional[str] = Query(None)

# 表单
class DemoFormRequest(BaseModel):
    id : Optional[int] = None
    name: Optional[str] = None
    age: Optional[int] = None

class DemoResponse(BaseModel):
    id: int
    username: str
    email: str

    class Config:
        orm_mode = True  # 允许ORM模式转换